<!--软件的自带菜单组件-->
<template>
<div>

</div>
</template>

<script>
let Menu = require("electron").remote.Menu;
import bus from 'emitvue';

export default {
  name: "HeadMenu",
  data(){
    return {

    }
  },
  methods:{
    // 创建菜单
    createMenu(){
        let template = [
          {
            label: "功能列表",
            submenu: [
              {
                label: "自动化测试",
                accelerator: 'shift+T',
                click: () => {
                  // 防止重复跳转而报错
                  if (this.$route.name === 'autoTest'){
                    return;
                  }

                  bus.$emit("autoTest",null);
                },
              },
              {
                label: "报文解析",
                accelerator: 'shift+P',
                click: () => {
                  // 防止重复跳转而报错
                  if (this.$route.name === 'contextParse'){
                    return;
                  }

                  bus.$emit("contextParse",null);
                },
              },
            ],
          },

        ];
        let MyMenu = Menu.buildFromTemplate(template);
        Menu.setApplicationMenu(MyMenu);
    },
  },
  created() {
    this.createMenu()
  },
}
</script>

<style scoped>

</style>
